<template>
  <div class="body">
    <header class="header">
      <div class="title">
        <img src="../../../assets/images/01_11.png" @click="getBack" alt class="img_zuo" />
        <div>巡查排查</div>
      </div>
    </header>

    <div class="search_list fenye" v-show="mhcx_flag&&fenye_flag">

      <!--<van-pull-refresh v-model="refreshing" @refresh="onRefresh">-->
      <van-list v-model="loading" :finished="finished" @load="onLoad">

        <div class="list_li" v-for="(item,index) of search_list" @click="li_click(item)">
          <img v-show="item.jwd" src="../../../assets/images/mhcx_y.png" />
          <img v-show="!item.jwd" src="../../../assets/images/mhcx_w.png" />
          <div class="name">{{item.mc}}</div>
          <div class="address">{{item.address}}</div>
          <div v-show="item.b_type!='zdqy'" class="type">{{getTypeObj(item.b_type,item.s_type,'id').mc}}</div>
          <div v-show="item.b_type=='zdqy'" class="type">企业</div>
        </div>

      </van-list>
      <!--</van-pull-refresh>-->

    </div>

    <div class="contant" v-show="!fenye_flag">
      <div id="ditu">
        <div class="types">
          <ul v-show="showTypes">
            <template v-for="(value,key,index) in types">
              <li @click="changeBType(key)" :class="{'active':b_type==key}">
                <div class="qiege">
                  <img v-show="key=='zjgd'" src="../../../../static/mark_5.png" />
                  <img v-show="key=='zdqy'" src="../../../../static/mark_6.png" />
                  <img v-show="key=='qt'" src="../../../../static/mark_4.png" />
                  <img v-show="key=='jzw'" src="../../../../static/mark_1.png" />
                  <img v-show="key=='jxmd'" src="../../../../static/mark_2.png" />
                  <img v-show="key=='zgf'" src="../../../../static/mark_3.png" />
                </div>
                <div class="value" v-show="key=='zjgd'">在建工地</div>
                <div class="value" v-show="key=='zdqy'">企业</div>
                <div class="value" v-show="key=='qt'">其他</div>
                <div class="value" v-show="key=='jzw'">建筑物</div>
                <div class="value" v-show="key=='jxmd'">九小门店</div>
                <div class="value" v-show="key=='zgf'">住改非</div>
              </li>
              <li @click="changeSType(type.id)" v-show="b_type==key" :class="{'active':s_type===type.id}"
                v-for="(type,ind) of types[key]">
                <div class="qiege"><img class="qiege_blank" src="../../../../static/mark_1.png" /></div>
                <div class="value">{{jiequ(type.mc,4,'…')}}</div>
              </li>
            </template>
          </ul>
          <!--
          <ul v-show="showTypes">
            <li @click="changeBType('zjgd')" :class="{'active':b_type=='zjgd'}">
              <div class="qiege"><img src="../../../../static/mark_5.png" /></div>
              <div class="value">在建工地</div>
            </li>
            <li @click="changeSType(type.id)" v-show="b_type=='zjgd'" :class="{'active':s_type===type.id}"
              v-for="(type,index) of types['zjgd']">
              <div class="qiege"><img class="qiege_blank" src="../../../../static/mark_1.png" /></div>
              <div class="value">{{jiequ(type.mc,4,'…')}}</div>
            </li>

            <li @click="changeBType('zdqy')" :class="{'active':b_type=='zdqy'}">
              <div class="qiege"><img src="../../../../static/mark_6.png" /></div>
              <div class="value">企业</div>
            </li>
            <li @click="changeSType(type.id)" v-show="b_type=='zdqy'" :class="{'active':s_type===type.id}"
              v-for="(type,index) of types['zdqy']">
              <div class="qiege"><img class="qiege_blank" src="../../../../static/mark_1.png" /></div>
              <div class="value">{{jiequ(type.mc,4,'…')}}</div>
            </li>

            <li @click="changeBType('jzw')">
              <div class="qiege"><img src="../../../../static/mark_1.png" /></div>
              <div class="value">建筑物</div>
            </li>
            <li @click="changeSType(type.id)" v-show="b_type=='jzw'" :class="{'active':s_type===type.id}"
              v-for="(type,index) of types['jzw']">
              <div class="qiege"><img class="qiege_blank" src="../../../../static/mark_1.png" /></div>
              <div class="value">{{jiequ(type.mc,4,'…')}}</div>
            </li>

            <li @click="changeBType('jxmd')">
              <div class="qiege"><img src="../../../../static/mark_2.png" /></div>
              <div class="value">九小门店</div>
            </li>
            <li @click="changeSType(type.id)" v-show="b_type=='jxmd'" :class="{'active':s_type===type.id}"
              v-for="(type,index) of types['jxmd']">
              <div class="qiege"><img class="qiege_blank" src="../../../../static/mark_2.png" /></div>
              <div class="value">{{jiequ(type.mc,4,'…')}}</div>
            </li>

            <li @click="changeBType('zgf')">
              <div class="qiege"><img src="../../../../static/mark_3.png" /></div>
              <div class="value">住改非</div>
            </li>
            <li @click="changeSType(type.id)" v-show="b_type=='zgf'" :class="{'active':s_type===type.id}"
              v-for="(type,index) of types['zgf']">
              <div class="qiege"><img class="qiege_blank" src="../../../../static/mark_3.png" /></div>
              <div class="value">{{jiequ(type.mc,4,'…')}}</div>
            </li>
          </ul>
          -->
          <button type="button" @click="toggleTypes">
            <img v-show="showTypes" src="../../../../static/a_r.png" />
            <img v-show="!showTypes" src="../../../../static/a_l.png" />
          </button>
        </div>
      </div>
      <div class="search-box" v-show="!mhcx_flag">
        <div class="search-input">
          <input type="text" placeholder="请输入地址/名称" v-model="searchValue" @keyup.enter="searchList" />
          <div class="search-img" v-show="!(searchValue||searchValue===0)">
            <img src="../../../assets/images/mhcx_look.png" />
          </div>
          <div class="search-img" v-show="searchValue||searchValue===0" @click="searchValue=''">
            <img src="../../../assets/images/mhcx_clear.png" />
          </div>
        </div>
        <div class="search-search-btn" v-show="searchValue||searchValue===0" @click="searchList">查询</div>
      </div>
      <div class="create-xcdx-btn" v-show="!mhcx_flag">
        <button @click="createXcdx">创建巡查对象</button>
      </div>
      <div class="search_list" v-show="mhcx_flag&&(!fenye_flag)">

        <div class="list_li" v-for="(item,index) of search_list" @click="li_click(item)">
          <img v-show="item.jwd" src="../../../assets/images/mhcx_y.png" />
          <img v-show="!item.jwd" src="../../../assets/images/mhcx_w.png" />
          <div class="name">{{item.mc}}</div>
          <div class="address">{{item.address}}</div>
          <div v-show="item.b_type!='zdqy'" class="type">{{getTypeObj(item.b_type,item.s_type,'id').mc}}</div>
          <div v-show="item.b_type=='zdqy'" class="type">企业</div>
        </div>

      </div>

    </div>

    <div class="tk no_data_tk" v-show="no_data">
      <div class="tk-bg" @click="closeNoDataTk"></div>
      <div class="tk-box">
        <div class="tk-head">
          <div class="tk-head-title">提示</div>
          <img class="tk-head-close" src="../../../assets/images/tk_x.png" @click="closeNoDataTk">
        </div>
        <div class="tk-list">
          <div class="tk-item">
            <span>查询无数据！</span>
          </div>
        </div>
        <div class="tk-btns">
          <div class="tk-btn radius-m" @click="closeNoDataTk">确定</div>
        </div>
      </div>
    </div>

    <div class="tk showDetail_tk" v-show="showDetail">
      <div class="tk-bg" @click="closeShowDetail"></div>
      <div class="tk-box">
        <div class="tk-head">
          <div class="tk-head-title"></div>
          <img class="tk-head-close" src="../../../assets/images/tk_x.png" @click="closeShowDetail">
        </div>
        <div class="tk-list">
          <div class="tk-item">
            <div class="tk-item-name">档案类别:</div>
            <div class="tk-item-value" v-show="detailObj.b_type=='zgf'">住改非</div>
            <div class="tk-item-value" v-show="detailObj.b_type=='jxmd'">九小门店</div>
            <div class="tk-item-value" v-show="detailObj.b_type=='jzw'">建筑物</div>
            <div class="tk-item-value" v-show="detailObj.b_type=='zdqy'">企业</div>
            <div class="tk-item-value" v-show="detailObj.b_type=='zjgd'">在建工地</div>
          </div>
          <div class="tk-item" v-show="detailObj.b_type=='zgf'">
            <div class="tk-item-name">小区名称:</div>
            <div class="tk-item-value">{{detailObj.mc}}</div>
          </div>
          <div class="tk-item" v-show="detailObj.b_type=='jzw'">
            <div class="tk-item-name">建筑名称:</div>
            <div class="tk-item-value">{{detailObj.mc}}</div>
          </div>
          <div class="tk-item" v-show="detailObj.b_type=='jxmd'">
            <div class="tk-item-name">单位名称:</div>
            <div class="tk-item-value">{{detailObj.mc}}</div>
          </div>
          <div class="tk-item" v-show="detailObj.b_type=='zdqy'">
            <div class="tk-item-name">企业名称:</div>
            <div class="tk-item-value">{{detailObj.mc}}</div>
          </div>
          <div class="tk-item">
            <div class="tk-item-name">具体地址:</div>
            <div class="tk-item-value">{{detailObj.address}}</div>
          </div>
          <div class="tk-item" v-show="detailObj.b_type=='zgf'">
            <div class="tk-item-name">用<span class="zw-span">占位</span>途:</div>
            <div class="tk-item-value">{{getTypeObj(detailObj.b_type,detailObj.s_type,'id').mc}}</div>
          </div>
          <div class="tk-item" v-show="detailObj.b_type=='jzw'">
            <div class="tk-item-name">产权性质:</div>
            <div class="tk-item-value">{{getTypeObj(detailObj.b_type,detailObj.s_type,'id').mc}}</div>
          </div>
          <div class="tk-item" v-show="detailObj.b_type=='jzw'">
            <div class="tk-item-name">层<span class="zw-span">占位</span>数:</div>
            <div class="tk-item-value">{{getJzcs(detailObj.floorNum)}}</div>
          </div>
          <div class="tk-item" v-show="detailObj.b_type=='jxmd'">
            <div class="tk-item-name">类<span class="zw-span">占位</span>别:</div>
            <div class="tk-item-value">{{getTypeObj(detailObj.b_type,detailObj.s_type,'id').mc}}</div>
          </div>
        </div>
        <div class="tk-btns">
          <div class="tk-btn radius-m" @click="startXc2">开始巡查</div>
        </div>
      </div>
    </div>


    <div class="tk createXcdx_tk" v-show="createXcdx_tk">
      <div class="tk-bg" @click="createXcdx_tk=false"></div>
      <div class="tk-box">
        <div class="tk-head">
          <div class="tk-head-title">创建巡查对象</div>
          <img class="tk-head-close" src="../../../assets/images/tk_x.png" @click="createXcdx_tk=false">
        </div>
        <div class="tk-list">
          <div class="tk-item">
            <div class="tk-item-name">类别:</div>
            <div class="tk-item-value" @click="selectLb">
              <span v-show="createXcdx_obj.b_type">
                <span v-show="createXcdx_obj.b_type=='jzw'">建筑物</span>
                <span v-show="createXcdx_obj.b_type=='jxmd'">九小门店</span>
                <span v-show="createXcdx_obj.b_type=='zgf'">住改非</span>
                <span v-show="createXcdx_obj.b_type=='zdqy'">企业</span>
                <span v-show="createXcdx_obj.b_type=='zjgd'">在建工地</span>
                <span v-show="createXcdx_obj.b_type=='qt'">其他</span>
                <span
                  v-show="createXcdx_obj.s_type||createXcdx_obj.s_type===0">{{getTypeObj(createXcdx_obj.b_type,createXcdx_obj.s_type,'id').mc}}</span>
                <span
                  v-show="!(createXcdx_obj.s_type||createXcdx_obj.s_type===0)&&createXcdx_obj.b_type!='zdqy'&&createXcdx_obj.b_type!='zjgd'&&createXcdx_obj.b_type!='qt'">请选择</span>
              </span>
              <span v-show="!createXcdx_obj.b_type">请选择</span>
              <div class="tk-item-select"><img src="../../../assets/images/appa_r.png" /></div>
            </div>
          </div>
          <div class="tk-item">
            <div class="tk-item-name">名称:</div>
            <div class="tk-item-value"><input type="text" placeholder="请输入" v-model="createXcdx_obj.mc" /></div>
          </div>
          <div class="tk-item">
            <div class="tk-item-name">地址:</div>
            <div class="tk-item-value"><input type="text" v-model="createXcdx_obj.address" /></div>
          </div>
        </div>
        <div class="tk-btns" v-if="(qx=='街道'||qx=='社区'||qx=='科室')&&createXcdx_obj.b_type!='zjgd'&&createXcdx_obj.b_type!='qt'&&jdsqObj.isedit===1">
          <div class="tk-btn radius-m" @click="createDangan">继续创建档案</div>
        </div>
        <div class="tk-btns" v-show="createXcdx_obj.b_type!='zdqy'&&createXcdx_obj.b_type!='zjgd'&&createXcdx_obj.b_type!='qt'">
          <div class="tk-btn radius-m"
            :class="{'createXcdx_wwc':!(createXcdx_obj.b_type&&(createXcdx_obj.s_type||createXcdx_obj.s_type===0)&&(createXcdx_obj.address||createXcdx_obj.address===0)&&(createXcdx_obj.mc||createXcdx_obj.mc===0))}"
            @click="startLsXc">开始临时巡查</div>
        </div>
        <div class="tk-btns" v-show="createXcdx_obj.b_type=='zdqy'||createXcdx_obj.b_type=='zjgd'||createXcdx_obj.b_type=='qt'">
          <div class="tk-btn radius-m"
            :class="{'createXcdx_wwc':!(createXcdx_obj.b_type&&(createXcdx_obj.address||createXcdx_obj.address===0)&&(createXcdx_obj.mc||createXcdx_obj.mc===0))}"
            @click="startLsXc">开始临时巡查</div>
        </div>
      </div>
    </div>

    <div class="tk xclb_tk" v-show="xclb_tk">
      <div class="tk-bg" @click="closeXclb"></div>
      <div class="tk-box">
        <div class="tk-head">
          <div class="tk-head-title">创建巡查对象</div>
          <img class="tk-head-close" src="../../../assets/images/tk_x.png" @click="closeXclb">
        </div>
        <div class="tk-list">
          <template v-for="(value,key,index) in types">
            <div class="tk-item" :class="{'active':xclb_obj.b_type==key}" @click="selectDlb(key)">
              <div class="tk-item-name" v-show="key=='zjgd'">在建工地</div>
              <div class="tk-item-name" v-show="key=='zdqy'">企业</div>
              <div class="tk-item-name" v-show="key=='qt'">其他</div>
              <div class="tk-item-name" v-show="key=='jzw'">建筑物</div>
              <div class="tk-item-name" v-show="key=='jxmd'">九小门店</div>
              <div class="tk-item-name" v-show="key=='zgf'">住改非</div>
            </div>
            <div class="tk-block" v-show="xclb_obj.b_type==key">
              <div class="tk-block-value" :class="{'active':xclb_obj.s_type===type.id}"
                v-for="(type,ind) of types[key]" @click="selectXlb(type.id)">{{type.mc}}</div>
            </div>
          </template>
          <!---
          <div class="tk-item" :class="{'active':xclb_obj.b_type=='zjgd'}" @click="selectDlb('zjgd')">
            <div class="tk-item-name">在建工地</div>
          </div>
          <div class="tk-block" v-show="xclb_obj.b_type=='zjgd'">
            <div class="tk-block-value" :class="{'active':xclb_obj.s_type===type.id}"
              v-for="(type,index) of types['zjgd']" @click="selectXlb(type.id)">{{type.mc}}</div>
          </div>
          <div class="tk-item" :class="{'active':xclb_obj.b_type=='zdqy'}" @click="selectDlb('zdqy')">
            <div class="tk-item-name">企业</div>
          </div>
          <div class="tk-block" v-show="xclb_obj.b_type=='zdqy'">
            <div class="tk-block-value" :class="{'active':xclb_obj.s_type===type.id}"
              v-for="(type,index) of types['zdqy']" @click="selectXlb(type.id)">{{type.mc}}</div>
          </div>
          <div class="tk-item" @click="selectDlb('jzw')">
            <div class="tk-item-name">建筑物</div>
          </div>
          <div class="tk-block" v-show="xclb_obj.b_type=='jzw'">
            <div class="tk-block-value" :class="{'active':xclb_obj.s_type===type.id}"
              v-for="(type,index) of types['jzw']" @click="selectXlb(type.id)">{{type.mc}}</div>
          </div>
          <div class="tk-item" @click="selectDlb('jxmd')">
            <div class="tk-item-name">九小门店</div>
          </div>
          <div class="tk-block" v-show="xclb_obj.b_type=='jxmd'">
            <div class="tk-block-value" :class="{'active':xclb_obj.s_type===type.id}"
              v-for="(type,index) of types['jxmd']" @click="selectXlb(type.id)">{{type.mc}}</div>
          </div>
          <div class="tk-item" @click="selectDlb('zgf')">
            <div class="tk-item-name">住改非</div>
          </div>
          <div class="tk-block" v-show="xclb_obj.b_type=='zgf'">
            <div class="tk-block-value" :class="{'active':xclb_obj.s_type===type.id}"
              v-for="(type,index) of types['zgf']" @click="selectXlb(type.id)">{{type.mc}}</div>
          </div>
          -->
        </div>
        <div class="tk-btns">
          <div class="tk-btn radius-m" @click="subXclb">确定</div>
        </div>
      </div>
    </div>


  </div>
</template>
<script>
  import Vue from 'vue';
  import { Dialog } from 'vant';
  import utils from "../../../assets/js/utils.js"
  import terminal from "../../../assets/js/terminal";
  export default {
    name: "xcdx_map",
    data() {
      return {
        map: null,
        markers: [],
        userMarker: null,
        showTypes: true,//控制是否显示 左边的类别列表
        b_type: 'jxmd',//类别大类(建筑物、九小门店、住改非)
        s_type: '',//类别小类，建筑物的产权性质，九小门店的类别，住改非的用途
        types: {},
        searchValue: '',//搜索框的内容
        jdsqObj: {},//用户的街道、社区和权限信息
        no_data: false,//控制是否显示 模糊查询没有数据的提示
        showDetail: false,//控制是否显示  点击地图上的标点后的弹框
        detailObj: {},//点击地图上的标点的数据
        search_list: [],//模糊查询结果列表
        li_click_obj: {},//点击模糊查询结果列表某一项的数据
        createXcdx_tk: false,//创建巡查对象的弹框
        createXcdx_obj: '',//创建巡查对象的对象
        xclb_tk: false,//巡查类别弹框
        xclb_obj: {},//巡查类别弹框对象
        xcdx_map_manager: {
          from: '/index',
          init: false
        },
        geolocation_timer: null,
        loading: false,
        finished: false,
        refreshing: false,
        page: 1,
        pageSize: 20,
        mhcx_position: null,
        fenye_flag: false,//分页
        mhcx_flag: false,//模糊查询
        yc_flag: false,//延迟关闭弹框
        terminal: false,
        timer5: null,
        timer3: null,
        dw_timer: null,
        timer4: null,
        timer7: null,
        setCenterFlag: false,
        qx: '',
        userId: null,
        isPc: true
      };
    },
    methods: {
      getuUserQx() {
        var _this = this;
        _this.qx = '';
        _this.axios.get(
          `${_this.$global_msg.Url.host}/monitoringPlan/isRight?userId=${_this.userId}`
        ).then((res) => {
          console.log("权限级别", res);
          if (res.data.rows.dwlev == 0) {//区级
            _this.qx = '区级';
          } else if (res.data.rows.dwlev == 1) {//街道
            _this.qx = '街道';
          } else if (res.data.rows.dwlev == 2) {//社区、科室
            if (res.data.rows.dwlxid == 1) {//科室
              _this.qx = '科室';
            } else {//社区
              _this.qx = '社区';
            }
          }
          console.log(_this.qx)
          _this.$forceUpdate();
        }).catch(error => {
          this.$terminal._error(error)
        });
      },
      getJzcs(cs) {
        var csStr = '';
        if (cs || cs === 0) {
          if (cs >= 10) {
            csStr = '高层建筑';
          } else {
            csStr = '一般建筑';
          }
        }
        return csStr;
      },
      closeNoDataTk() {
        if (this.yc_flag) {
          return;
        }
        this.no_data = false;
      },
      onLoad() {
        var _this = this;
        if (!(_this.fenye_flag && _this.mhcx_flag)) {
          _this.loading = false;
          return;
        }
        if (_this.refreshing) {
          _this.search_list = [];
          _this.refreshing = false;
          _this.page = 1;
        }

        /*try{
          plus.nativeUI.showWaiting("正在加载...");
        }catch(e){
          console.log(e.message);
        }*/

        var url = '';
        var params = {};

        params = {
          jd: _this.mhcx_position.lng,
          wd: _this.mhcx_position.lat,
          streetId: _this.jdsqObj.jd_id,
          communityId: _this.jdsqObj.sq_id,
          addrOrname: _this.searchValue,
          page: _this.page,
          pageSize: _this.pageSize
        };
        url = _this.$global_msg.Url.host + "/nineStore/selectDataBySearch";
        _this.axios.get(url, {
          params: params
        }).then(function (data) {
          console.log('findZgfinfoListByMultiConditions:', data);
          if (data && data.data) {
            if (data.data.code == 200) {

              if (data.data.rows && data.data.rows.data && data.data.rows.data.length > 0) {
                for (var n = 0; n < data.data.rows.data.length; n++) {
                  if (data.data.rows.data[n].fileCategory == '建筑物') {
                    data.data.rows.data[n].b_type = 'jzw';
                    data.data.rows.data[n].s_type = _this.getTypeObj(data.data.rows.data[n].b_type, data.data.rows.data[n].type, 'mc').id;
                  } else if (data.data.rows.data[n].fileCategory == '九小门店') {
                    data.data.rows.data[n].b_type = 'jxmd';
                    data.data.rows.data[n].s_type = data.data.rows.data[n].type * 1;
                  } else if (data.data.rows.data[n].fileCategory == '住改非') {
                    data.data.rows.data[n].b_type = 'zgf';
                    data.data.rows.data[n].s_type = _this.getTypeObj(data.data.rows.data[n].b_type, data.data.rows.data[n].type, 'mc').id;
                  } else if (data.data.rows.data[n].fileCategory == '企业') {
                    data.data.rows.data[n].b_type = 'zdqy';
                  } else if (data.data.rows.data[n].fileCategory == '在建工地') {
                    data.data.rows.data[n].b_type = 'zjgd';
                  }
                  data.data.rows.data[n].jwd = data.data.rows.data[n].map;
                }
                _this.search_list = _this.search_list.concat(data.data.rows.data);
                if (_this.search_list.length >= data.data.rows.total || !data.data.rows.total) {
                  _this.finished = true;
                } else {
                  _this.page++;
                }
              } else {
                _this.finished = true;
              }
            } else {
              _this.$toast(data.data.msg);
              _this.finished = true;
            }
          } else {
            _this.$toast('查询失败');
            _this.finished = true;
          }
          _this.loading = false;

          try {
            plus.nativeUI.closeWaiting();
          } catch (e) {
            console.log(e.message);
          }
        }).catch(error => {
          this.$terminal._error(error)
        });
      },
      onRefresh() {
        // 清空列表数据
        this.finished = false;

        // 重新加载数据
        // 将 loading 设置为 true，表示处于加载状态
        this.loading = true;
        this.onLoad();
      },
      getBack() {//返回
        // this.$router.push(this.xcdx_map_manager.from);
        this.$router.back()
      },
      toggleTypes() {//显示或隐藏类别列表
        this.showTypes = !this.showTypes;
      },
      createXcdx() {//点击"创建巡查对象"按钮
        var _this = this;

        try {
          plus.nativeUI.showWaiting("正在加载...");
        } catch (e) {
          console.log(e.message);
        }
        AMap.service(["AMap.PlaceSearch"], function () {
          //构造地点查询类
          var placeSearch = new AMap.PlaceSearch({
            city: "重庆", // 兴趣点城市
            //citylimit: true,  //是否强制限制在设置的城市内搜索
          });

          if (!_this.userMarker) {
            try {
              plus.nativeUI.closeWaiting();
            } catch (e) {
              console.log(e.message);
            }
            _this.$toast('正在获取定位，请稍等');
            return;
          }

          var position = _this.userMarker.getPosition();
          placeSearch.searchNearBy('', position, 50, function (status, result) {
            console.log(status)
            console.log(result)
            if (status == 'complete') {
              _this.createXcdx_obj = {
                id: null,
                b_type: _this.b_type,
                s_type: _this.s_type,
                mc: '',
                address: result.poiList.pois[0].address,
                //jd:result.poiList.pois[0].location.lng,//经度
                //wd:result.poiList.pois[0].location.lat,//纬度
                jwd: (result.poiList.pois[0].location.lng + ',' + result.poiList.pois[0].location.lat)//经纬度
              };
            } else {//没有数据
              _this.createXcdx_obj = {
                id: null,
                b_type: _this.b_type,
                s_type: _this.s_type,
                mc: '',
                address: '未命名地址',
                //jd:result.poiList.pois[0].location.lng,//经度
                //wd:result.poiList.pois[0].location.lat,//纬度
                jwd: (position.lng + ',' + position.lat)//经纬度
              };
            }
            _this.createXcdx_tk = true;
            try {
              plus.nativeUI.closeWaiting();
            } catch (e) {
              console.log(e.message);
            }
          });
        });

      },
      createDangan() {//点击"继续创建档案"按钮
        this.createXcdx_obj.s_type_mc = this.getTypeObj(this.createXcdx_obj.b_type, this.createXcdx_obj.s_type, 'id').mc;
        var xcdx_map_action = {
          type: 'add',
          obj: this.createXcdx_obj
        };
        localStorage.setItem("xcdx_map_action", JSON.stringify(xcdx_map_action));
        localStorage.removeItem("xqda_params");
        this.stopGeolocation();
        if (this.createXcdx_obj.b_type == 'jzw') {
          this.$router.push("/jzw_edit");
        } else if (this.createXcdx_obj.b_type == 'jxmd') {
          this.$router.push("/jxmd_edit");
        } else if (this.createXcdx_obj.b_type == 'zgf') {
          this.$router.push("/zgf_edit");
        } else if (this.createXcdx_obj.b_type == 'zdqy') {
          this.$router.push("/qy_edit");
        }
      },
      listFormat(list) {
        for (var n = 0; n < list.length; n++) {
          if (list[n].b_type == 'zgf') {
            list[n].address = list[n].dizhi;//地址
            list[n].s_type = list[n].ytid;//用途 小类
            list[n].mc = list[n].xq;//小区名称
          } else if (list[n].b_type == 'jxmd') {
            list[n].jwd = list[n].map;//经纬度
            list[n].s_type = list[n].type;//类别 小类
            list[n].mc = list[n].dwMc;//单位名称
          } else if (list[n].b_type == 'jzw') {
            list[n].jwd = list[n].map;//经纬度
            list[n].s_type = list[n].propertyNature;//产权性质 小类
            list[n].mc = list[n].name;//建筑名称
            list[n].floorNum = list[n].floornum;//层数
          } else if (list[n].b_type == 'zdqy') {
            list[n].jwd = list[n].map;//经纬度
          } else if (list[n].b_type == 'zjgd') {
            list[n].jwd = list[n].map;//经纬度
          }
        }
        return list;
      },
      mark_list(list) {//在地图上创建对应数据的标点
        var _this = this;
        if (_this.timer3 || _this.timer3 === 0) {
          return;
        }
        _this.timer3 = setInterval(function () {
          if (_this.userMarker) {
            clearInterval(_this.timer3);
            _this.timer3 = null;

            if (_this.map) {
              _this.map.remove(_this.markers);
            }
            _this.markers = [];
            var dians = [];
            for (var n = 0; n < list.length; n++) {
              if (list[n].jwd) {
                var p2 = list[n].jwd.split(',');
                // 返回 p1 到 p2 间的地面距离，单位：米
                var dis = AMap.GeometryUtil.distance(_this.mhcx_position, p2);
                //console.log('距离：',dis);
                //console.log('是否距离：',dis<=200);
                if (dis <= 200) {
                  dians.push(list[n]);
                }
              }
            }
            for (var n = 0; n < dians.length; n++) {
              //创建标点
              _this.biaodian(dians[n]);
            }
            _this.map.setFitView();
            _this.setCenterFlag = true;

          }
        }, 100);
      },
      getDwInfo(id, type, jwd, func) {
        var _this = this;
        if (_this.dw_timer || _this.dw_timer === 0) {
          return;
        }
        _this.dw_timer = setInterval(function () {
          if (_this.userMarker) {
            clearInterval(_this.dw_timer);
            _this.dw_timer = null;
            try {
              plus.nativeUI.showWaiting("正在加载...");
            } catch (e) {
              console.log(e.message);
            }
            var position = _this.userMarker.getPosition();
            var jwd2 = position.lng + ',' + position.lat;
            var xcpc_da_obj = {
              id: id,
              type: type,
              jwd: jwd2,
              oldjwd: jwd
            };
            localStorage.setItem("xcpc_da_obj", JSON.stringify(xcpc_da_obj));
            try {
              plus.nativeUI.closeWaiting();
            } catch (e) {
              console.log(e.message);
            }
            func();
          }
        }, 100);
      },
      startXc2() {//点击地图上标点的"巡查"按钮
        var _this = this;
        if (_this.yc_flag) {
          return;
        }
        _this.detailObj.s_type_mc = _this.getTypeObj(_this.detailObj.b_type, _this.detailObj.s_type, 'id').mc;
        _this.getDwInfo(_this.detailObj.id, _this.detailObj.b_type, _this.detailObj.jwd, function () {
          localStorage.setItem("xcdx_map_xcdxObj", JSON.stringify(_this.detailObj));
          _this.stopGeolocation();
          localStorage.removeItem("param_fgd");
          // _this.$router.push(_this.xcdx_map_manager.from);
          _this.$router.back()
        });
      },
      startLsXc() {//点击"开始临时巡查"按钮
        var _this = this;
        if (_this.createXcdx_obj.b_type == 'zdqy' || _this.createXcdx_obj.b_type == 'zjgd'|| _this.createXcdx_obj.b_type == 'qt') {
          if (!(_this.createXcdx_obj.b_type && (_this.createXcdx_obj.address || _this.createXcdx_obj.address === 0))) {
            return;
          }
        } else {
          if (!(_this.createXcdx_obj.b_type && (_this.createXcdx_obj.s_type || _this.createXcdx_obj.s_type === 0) && (_this.createXcdx_obj.address || _this.createXcdx_obj.address === 0))) {
            return;
          }
        }
        _this.getDwInfo(null, _this.createXcdx_obj.b_type, _this.createXcdx_obj.jwd, function () {
          _this.createXcdx_obj.s_type_mc = _this.getTypeObj(_this.createXcdx_obj.b_type, _this.createXcdx_obj.s_type, 'id').mc;
          localStorage.setItem("xcdx_map_xcdxObj", JSON.stringify(_this.createXcdx_obj));
          _this.stopGeolocation();
          localStorage.removeItem("param_fgd");
          // _this.$router.push(_this.xcdx_map_manager.from);
          _this.$router.back()
        });
      },
      changeBType(b_type) {//切换大类别(建筑物、九小门店、住改非)
        this.b_type = b_type;
        this.s_type = '';
        this.getList();
      },
      changeSType(s_type) {//切换小类别
        this.s_type = s_type;
        this.getList();
      },
      selectLb() {//显示创建巡查对象选择类别
        this.xclb_obj = {
          b_type: this.createXcdx_obj.b_type,
          s_type: this.createXcdx_obj.s_type
        };
        this.createXcdx_tk = false;
        this.xclb_tk = true;
      },
      selectDlb(b_type) {//选择类别弹框 选择大类
        this.xclb_obj.b_type = b_type;
        this.xclb_obj.s_type = '';
        this.$forceUpdate();
      },
      selectXlb(s_type) {//选择类别弹框 选择小类
        this.xclb_obj.s_type = s_type;
        this.$forceUpdate();
      },
      closeXclb() {//关闭选择类别弹框
        this.xclb_tk = false;
        this.createXcdx_tk = true;
      },
      subXclb() {//选择类别弹框 确定按钮
        this.createXcdx_obj.b_type = this.xclb_obj.b_type;
        this.createXcdx_obj.s_type = this.xclb_obj.s_type;
        this.xclb_tk = false;
        this.createXcdx_tk = true;
      },
      li_click(item) {//点击模糊查询列表的某一项
        this.look(item);
      },
      jiequ(str, num, tail) {//截取字符串
        tail = tail ? ('' + tail) : '';
        if ((str || str === 0) && str.length > num) {
          str = str.substring(0, num) + tail;
        }
        return str;
      },
      createMap() {//创建地图
        var _this = this;
        _this.map = new AMap.Map('ditu', {
          zoomEnable: true, //地图是否可缩放，默认值为true
        });
        // 传入经纬度，设置地图中心点
        //渝中区106.57,29.55
        //杨家坪106.512339,29.505386
        var position = new AMap.LngLat(_this.$global_msg.centerJwd.jd, _this.$global_msg.centerJwd.wd);  // 标准写法
        _this.map.setCenter(position);
        // 设置地图级别，级别为数字。
        // PC上，参数zoom可设范围：[3,18]；
        // 移动端：参数zoom可设范围：[3,19]
        _this.map.setZoom(18);

        //地图点击事件
        /*_this.map.on('click', function(ev) {
          // 触发事件的对象
          var target = ev.target;
          // 触发事件的地理坐标，AMap.LngLat 类型
          var lnglat = ev.lnglat;
          // 触发事件的像素坐标，AMap.Pixel 类型
          var pixel = ev.pixel;
          // 触发事件类型
          var type = ev.type;

          //清楚所有标点
          // for(var n=0;n<_this.markers.length;n++){
          //   _this.map.remove(_this.markers[n]);
          // }
          //创建标点
          _this.biaodian(lnglat);
        });*/
        _this.startGeolocation();
      },
      startGeolocation() {//开始定位
        var _this = this;
        clearInterval(_this.geolocation_timer);
        _this.geolocation_timer = null;
        _this.map.plugin('AMap.Geolocation', function () {
          var geolocation = new AMap.Geolocation({
            // 是否使用高精度定位，默认：true
            enableHighAccuracy: true,
            // 设置定位超时时间，默认：无穷大
            //timeout: 10000,
            // 定位按钮的停靠位置的偏移量，默认：Pixel(10, 20)
            //buttonOffset: new AMap.Pixel(10, 20),
            //  定位成功后调整地图视野范围使定位位置及精度范围视野内可见，默认：false
            //zoomToAccuracy: false,
            //  定位按钮的排放位置,  RB表示右下
            //buttonPosition: 'RB'
          })

          // 监听获取位置信息成功的回调函数
          AMap.event.addListener(geolocation, 'complete', onComplete);
          // 监听获取位置信息错误的回调函数
          AMap.event.addListener(geolocation, 'error', onError);

          function usePosition(lng,lat){
            var position = {};
            if (_this.terminal !== true) {
              position = utils.getGpsPosition(lng,lat);
            } else {
              position = new AMap.LngLat(lng,lat);
            }
            if (_this.userMarker) {
              _this.userMarker.setPosition(position);
              //_this.userMarker.setPosition([106.512339,29.505386]);
              if (_this.setCenterFlag) {
                _this.setCenterFlag = false;
                _this.map.setCenter(position);
              }
            } else {
              //创建标点
              _this.markUser(position);
            }
          }

          function onComplete(data) {
            usePosition(data.position.lng,data.position.lat);
          }

          function onError(error) {
            // 定位出错
            //console.log(error)
            if (error.message == 'Geolocation permission denied.') {
              //_this.tishiDw();
            }
            utils.getPosition(function(lng,lat){
              console.log('切换使用sdk获取定位成功:'+lng+','+lat);
              usePosition(lng,lat);
            },function(msg){
              console.log('获取定位错误:'+msg);
            });
          }

          if (_this.isPc) {
            geolocation.getCurrentPosition();
            _this.geolocation_timer = setInterval(function () {
              // 获取当前位置信息
              geolocation.getCurrentPosition();
            }, 1000);
          } else {
            function startGetDw() {
              plus.geolocation.getCurrentPosition(function (p) {
                geolocation.getCurrentPosition();
                _this.geolocation_timer = setInterval(function () {
                  // 获取当前位置信息
                  geolocation.getCurrentPosition();
                }, 1000);
              }, function (e) {
                //alert(JSON.stringify(e))
                _this.tishiDw();
              });
            }
            if (plus) {
              startGetDw();
            } else {
              document.addEventListener('plusready', function () {
                startGetDw();
              }, false);
            }
          }
        })
      },
      tishiDw() {
        var _this = this;
        var isAndroid = terminal.terminals().android;
        Dialog.confirm({
          title: '提示',
          message: '请打开定位',
          confirmButtonText: "去设置", //改变确认按钮上显示的文字
          cancelButtonText: "取消" //改变取消按钮上显示的文字
        }).then(() => {
          //console.log("点击了确认按钮噢")
          if (isAndroid) {//安卓系统
            var main = plus.android.runtimeMainActivity();
            var Intent = plus.android.importClass("android.content.Intent");
            var mIntent = new Intent('android.settings.LOCATION_SOURCE_SETTINGS');
            main.startActivity(mIntent);
          } else {//IOS系统
            var UIApplication = plus.ios.import("UIApplication");
            var NSURL = plus.ios.import("NSURL");
            var setting = NSURL.URLWithString("app-settings:");
            var application = UIApplication.sharedApplication();
            application.openURL(setting);
            plus.ios.deleteObject(setting);
            plus.ios.deleteObject(application);
          }
        }).catch(() => {
          //console.log("点击了取消按钮噢")
        });
        _this.stopGeolocation();
      },
      stopGeolocation() {//停止定位
        clearInterval(this.geolocation_timer);
        clearInterval(this.timer5);
        clearInterval(this.timer3);
        clearInterval(this.dw_timer);
        clearInterval(this.timer4);
        clearInterval(this.timer7);
        this.geolocation_timer = null;
        this.timer5 = null;
        this.timer3 = null;
        this.dw_timer = null;
        this.timer4 = null;
        this.timer7 = null;
      },
      markUser(lnglat) {//用户标点
        var _this = this;
        var content = '';
        content += '<div>';
        content += '<img style="width: 0.601851rem;height: 0.518518rem;position: relative;top: -0.185185rem;" src="' + require('../../../assets/images/yhwz.png') + '"/>';
        content += '</div>';
        // 创建一个 Marker 实例：
        var marker = new AMap.Marker({
          position: lnglat,// 经纬度对象，也可以是经纬度构成的一维数组[116.39, 39.9]
          //title: '标点',
          content: content
        });
        // 设置点标记的动画效果，此处为弹跳效果
        //marker.setAnimation('AMAP_ANIMATION_BOUNCE');
        // 将创建的点标记添加到已有的地图实例：
        //marker.dataObj = obj;
        _this.map.add(marker);
        _this.userMarker = marker;
        if (_this.setCenterFlag) {
          _this.setCenterFlag = false;
          _this.map.setCenter(lnglat);
        }
      },
      biaodian(obj) {//标点
        var _this = this;
        var type_img = _this.getTypeObj(obj.b_type, obj.s_type, 'id').img;
        type_img = (type_img || type_img === 0) ? type_img : '1';

        var content = '';
        content += '<div>';
        content += '<img style="width: 0.296296rem;height: 0.574074rem;position: relative;top: -0.185185rem;" src="' + require('../../../../static/mark_' + type_img + '.png') + '"/>';
        content += '</div>';
        // 创建一个 Marker 实例：
        var lnglat = obj.jwd.split(',');
        var marker = new AMap.Marker({
          position: lnglat,// 经纬度对象，也可以是经纬度构成的一维数组[116.39, 39.9]
          //title: '标点',
          content: content
        });
        // 设置点标记的动画效果，此处为弹跳效果
        //marker.setAnimation('AMAP_ANIMATION_BOUNCE');
        // 将创建的点标记添加到已有的地图实例：
        marker.dataObj = obj;
        marker.on('click', function (o) {
          console.log(o)
          //_this.map.remove(o.target);
          _this.look(o.target.dataObj);
        });
        _this.map.add(marker);
        _this.markers.push(marker);
        //_this.map.setFitView();
      },
      look(obj) {//点击地图上标点后执行的操作
        console.log(obj)
        var _this = this;
        _this.detailObj = obj;
        _this.showDetail = true;
        _this.yc_flag = true;
        _this.$forceUpdate();
        setTimeout(function () {
          _this.yc_flag = false;
        }, 100);
      },
      closeShowDetail() {
        if (this.yc_flag) {
          return;
        }
        this.showDetail = false;
      },
      searchList() {//模糊查询
        this.getListMh();
      },
      getTypes() {//获取类别
        var _this = this;
        _this.types = {};
        _this.types['jzw'] = [
          { mc: '住宅', id: 1, img: 1 },
          { mc: '商用', id: 2, img: 2 },
          { mc: '商住混合', id: 3, img: 3 },
          { mc: '其他', id: 4, img: 4 }
        ]
        _this.types['jxmd'] = [
          { mc: '小商场', id: 1, img: 1 },
          { mc: '小医院', id: 2, img: 2 },
          { mc: '小餐饮场所', id: 3, img: 3 },
          { mc: '小旅馆', id: 4, img: 4 },
          { mc: '小歌舞厅娱乐场所', id: 5, img: 5 },
          { mc: '小网吧', id: 6, img: 6 },
          { mc: '小美容洗浴场所', id: 7, img: 7 },
          { mc: '小生产加工企业', id: 8, img: 8 },
          { mc: '废品回收', id: 9, img: 9 },
          { mc: '其他', id: 10, img: 10 }
        ];
        _this.types['zgf'] = [];
        _this.types['zdqy'] = [
          //{mc:'重点企业',id:5,img:1}
          /*{mc:'重点检查',id:1,img:1},
          {mc:'一般检查',id:2,img:2},
          {mc:'随机抽查',id:3,img:3}*/
        ]
        _this.types['zjgd'] = [];
        _this.types['qt'] = [];
        try {
          plus.nativeUI.showWaiting("正在加载...");
        } catch (e) {
          console.log(e.message);
        }
        //查询住改非用途
        var url = _this.$global_msg.Url.host + "/queryFile/selectYt";
        var params = {};
        _this.axios.get(url, {
          params: params
        }).then(function (data) {
          console.log('查询弹框列表:', data);
          if (data && data.data) {
            if (data.data.code === 0) {
              for (var n = 0; n < data.data.rows.length; n++) {
                var id = data.data.rows[n].id;
                var img = '';
                if (id === 1) {
                  img = 1;
                } else if (id === 2) {
                  img = 2;
                } else if (id === 3) {
                  img = 3;
                } else if (id === 4) {
                  img = 4;
                } else if (id === 6) {
                  img = 5;
                } else if (id === 7) {
                  img = 6;
                } else if (id === 8) {
                  img = 7;
                }
                data.data.rows[n].img = img;
              }
              _this.types['zgf'] = data.data.rows;
              _this.$forceUpdate();
            } else {
              _this.$toast(data.data.msg);
            }
          } else {
            _this.$toast('查询失败');
          }
          try {
            plus.nativeUI.closeWaiting();
          } catch (e) {
            console.log(e.message);
          }
        }).catch(error => {
          this.$terminal._error(error)
        });
      },
      getJdsq() {//获取用户的街道、社区和权限信息
        var _this = this;
        try {
          plus.nativeUI.showWaiting("正在加载...");
        } catch (e) {
          console.log(e.message);
        }
        _this.jdsqObj = {};
        _this.axios.get(_this.$global_msg.Url.host + "/nineStore/selectStreetAndCommunity", {
          params: {
            userId: _this.userId
          }
        }).then(function (data) {
          try {
            plus.nativeUI.closeWaiting();
          } catch (e) {
            console.log(e.message);
          }
          console.log('selectStreetAndCommunity:', data);
          if (data && data.data) {
            _this.jdsqObj = {
              sq_id: '',//社区id
              sq_mc: '',//社区名称
              jd_id: '',//街道id
              jd_mc: '',//街道名称
              lev: data.data.rows.lev,
              isedit: null
            };
            if (data.data.rows.lev === '0') {
              //最高权限，有多个街道信息
              //data.data.rows.jd[0]
            } else if (data.data.rows.lev === '1') {
              //街道
              if (data.data.rows.jd) {
                _this.jdsqObj.jd_id = data.data.rows.jd.id;
                _this.jdsqObj.jd_mc = data.data.rows.jd.mc;
                _this.jdsqObj.isedit = data.data.rows.jd.isedit;
              }
            } else if (data.data.rows.lev === '2') {
              //社区
              if (data.data.rows.jd) {
                _this.jdsqObj.jd_id = data.data.rows.jd.id;
                _this.jdsqObj.jd_mc = data.data.rows.jd.mc;
              }
              if (data.data.rows.sq) {
                _this.jdsqObj.sq_id = data.data.rows.sq.id;
                _this.jdsqObj.sq_mc = data.data.rows.sq.mc;
                _this.jdsqObj.isedit = data.data.rows.sq.isedit;
              }
            }
          } else {
            _this.$toast('查询失败');
          }
        }).catch(error => {
          this.$terminal._error(error)
        });
      },
      /**
       * 根据id或名称获取类别信息(对象)，没有获取到就返回空对象
       * @param {Object} b_t 大类，如果为空返回空对象
       * @param {Object} s_t 小类，如果为空返回空对象
       * @param {Object} type 是根据id或mc获取，如果为空返回空对象
       */
      getTypeObj(b_t, s_t, type) {
        var _this = this;
        if ((b_t || b_t === 0) && (s_t || s_t === 0)) {
          for (var n = 0; n < _this.types[b_t].length; n++) {
            if (type == 'id') {
              if (_this.types[b_t][n].id === s_t) {
                return _this.types[b_t][n];
              }
            } else if (type == 'mc') {
              if (_this.types[b_t][n].mc === s_t) {
                return _this.types[b_t][n];
              }
            }
          }
        }
        return {};
      },
      getListMh() {//模糊查询 分页
        var _this = this;
        if (_this.timer5 || _this.timer5 === 0) {
          return;
        }
        _this.timer5 = setInterval(function () {
          if (_this.userMarker) {
            clearInterval(_this.timer5);
            _this.timer5 = null;
            try {
              plus.nativeUI.showWaiting("正在加载...");
            } catch (e) {
              console.log(e.message);
            }
            _this.page = 1;
            var url = '';
            var params = {};
            _this.mhcx_position = _this.userMarker.getPosition();

            params = {
              jd: _this.mhcx_position.lng,
              wd: _this.mhcx_position.lat,
              streetId: _this.jdsqObj.jd_id,
              communityId: _this.jdsqObj.sq_id,
              addrOrname: _this.searchValue,
              page: _this.page,
              pageSize: _this.pageSize
            };
            url = _this.$global_msg.Url.host + "/nineStore/selectDataBySearch";
            _this.axios.get(url, {
              params: params
            }).then(function (data) {
              console.log('selectDataBySearch:', data);
              try {
                plus.nativeUI.closeWaiting();
              } catch (e) {
                console.log(e.message);
              }
              if (data && data.data) {
                if (data.data.code == 200) {
                  _this.search_list = [];
                  if (data.data.rows && data.data.rows.data && data.data.rows.data.length > 0) {
                    _this.mhcx_flag = true;
                    if (data.data.rows.data.length > 10) {
                      try {
                        plus.nativeUI.showWaiting("正在加载...");
                      } catch (e) {
                        console.log(e.message);
                      }
                      _this.fenye_flag = true;
                      _this.onRefresh();
                    } else {
                      _this.fenye_flag = false;
                      if (_this.map) {
                        _this.map.remove(_this.markers);
                      }
                      _this.markers = [];

                      for (var n = 0; n < data.data.rows.data.length; n++) {
                        if (data.data.rows.data[n].fileCategory == '建筑物') {
                          data.data.rows.data[n].b_type = 'jzw';
                          data.data.rows.data[n].s_type = _this.getTypeObj(data.data.rows.data[n].b_type, data.data.rows.data[n].type, 'mc').id;
                        } else if (data.data.rows.data[n].fileCategory == '九小门店') {
                          data.data.rows.data[n].b_type = 'jxmd';
                          data.data.rows.data[n].s_type = data.data.rows.data[n].type * 1;
                        } else if (data.data.rows.data[n].fileCategory == '住改非') {
                          data.data.rows.data[n].b_type = 'zgf';
                          data.data.rows.data[n].s_type = _this.getTypeObj(data.data.rows.data[n].b_type, data.data.rows.data[n].type, 'mc').id;
                        } else if (data.data.rows.data[n].fileCategory == '企业') {
                          data.data.rows.data[n].b_type = 'zdqy';
                        } else if (data.data.rows.data[n].fileCategory == '在建工地') {
                          data.data.rows.data[n].b_type = 'zjgd';
                        }
                        data.data.rows.data[n].jwd = data.data.rows.data[n].map;
                      }
                      _this.search_list = data.data.rows.data;
                      _this.mark_list(data.data.rows.data);
                    }
                    var xcdx_map_result_obj = {
                      showTypes: _this.showTypes,//控制是否显示 左边的类别列表
                      b_type: _this.b_type,//类别大类(建筑物、九小门店、住改非)
                      s_type: _this.s_type,//类别小类，建筑物的产权性质，九小门店的类别，住改非的用途
                      types: _this.types,
                      searchValue: _this.searchValue,//搜索框的内容
                      jdsqObj: _this.jdsqObj,//用户的街道、社区和权限信息
                      no_data: _this.no_data,//控制是否显示 模糊查询没有数据的提示
                      showDetail: _this.showDetail,//控制是否显示  点击地图上的标点后的弹框
                      detailObj: _this.detailObj,//点击地图上的标点的数据
                      search_list: _this.search_list,//模糊查询结果列表
                      li_click_obj: _this.li_click_obj,//点击模糊查询结果列表某一项的数据
                      createXcdx_tk: _this.createXcdx_tk,//创建巡查对象的弹框
                      createXcdx_obj: _this.createXcdx_obj,//创建巡查对象的对象
                      xclb_tk: _this.xclb_tk,//巡查类别弹框
                      xclb_obj: _this.xclb_obj,//巡查类别弹框对象
                      loading: _this.loading,
                      finished: _this.finished,
                      refreshing: _this.refreshing,
                      page: _this.page,
                      pageSize: _this.pageSize,
                      fenye_flag: _this.fenye_flag,//分页
                      mhcx_flag: _this.mhcx_flag,//模糊查询
                      yc_flag: _this.yc_flag,//延迟关闭弹框
                      terminal: _this.terminal,
                      mhcx_position: _this.mhcx_position,
                      init: true
                    };
                    localStorage.setItem("xcdx_map_result_obj", JSON.stringify(xcdx_map_result_obj));
                    _this.$router.push("/xcdx_map_result");
                  } else {
                    _this.mhcx_flag = false;
                    _this.no_data = true;
                    _this.fenye_flag = false;
                    _this.yc_flag = true;
                    _this.$forceUpdate();
                    setTimeout(function () {
                      _this.yc_flag = false;
                    }, 100);
                  }
                } else {
                  _this.$toast(data.data.msg);
                }
              } else {
                _this.$toast('查询失败');
              }
            }).catch(error => {
              this.$terminal._error(error)
            });
          }
        }, 100);

      },
      getList() {//查询数据 根据类别 有经纬度
        var _this = this;
        if (_this.timer4 || _this.timer4 === 0) {
          return;
        }
        _this.timer4 = setInterval(function () {
          if (_this.userMarker) {
            clearInterval(_this.timer4);
            _this.timer4 = null;

            var url = '';
            var params = {};
            _this.mhcx_position = _this.userMarker.getPosition();
            _this.fenye_flag = false;
            _this.mhcx_flag = false;

            if (_this.b_type == 'zgf') {
              params = {
                jd: _this.mhcx_position.lng,
                wd: _this.mhcx_position.lat,
                streetId: _this.jdsqObj.jd_id,
                dwid: _this.jdsqObj.sq_id,
                ytid: _this.s_type
              };
              url = _this.$global_msg.Url.host + "/zgfinfo/selectZgfByMap";
            } else if (_this.b_type == 'jxmd') {
              params = {
                jd: _this.mhcx_position.lng,
                wd: _this.mhcx_position.lat,
                streetId: _this.jdsqObj.jd_id,
                communityId: _this.jdsqObj.sq_id,
                type: _this.s_type
              };
              url = _this.$global_msg.Url.host + "/nineStore/selectNineStroeByMap";
            } else if (_this.b_type == 'jzw') {
              params = {
                jd: _this.mhcx_position.lng,
                wd: _this.mhcx_position.lat,
                dwStreetId: _this.jdsqObj.jd_id,
                dwCommunityId: _this.jdsqObj.sq_id,
                propertyNature: _this.s_type
              };
              url = _this.$global_msg.Url.host + "/construction/selectConstructionByMap";
            } else if (_this.b_type == 'zdqy') {
              params = {
                longitude: _this.mhcx_position.lng,
                latitude: _this.mhcx_position.lat,
                streetId: _this.jdsqObj.jd_id,
                communityId: _this.jdsqObj.sq_id
              };
              url = _this.$global_msg.Url.host + "/nineStore/selectKeyFile";
            } else {
              if (_this.map) {
                _this.map.remove(_this.markers);
              }
              _this.markers = [];
              _this.search_list = [];
              _this.searchValue = '';
              return;
            }
            try {
              plus.nativeUI.showWaiting("正在加载...");
            } catch (e) {
              console.log(e.message);
            }
            _this.axios.get(url, {
              params: params
            }).then(function (data) {
              console.log('findZgfinfoListByMultiConditions:', data);
              if (data && data.data) {
                if (data.data.code == 0) {

                  if (_this.map) {
                    _this.map.remove(_this.markers);
                  }
                  _this.markers = [];
                  _this.search_list = [];
                  _this.searchValue = '';
                  if (data.data.rows && data.data.rows.length > 0) {
                    for (var n = 0; n < data.data.rows.length; n++) {
                      data.data.rows[n].b_type = _this.b_type;
                    }
                    var _list = _this.listFormat(data.data.rows);
                    _this.mark_list(_list);
                  }
                } else {
                  _this.$toast(data.data.msg);
                }
              } else {
                _this.$toast('查询失败');
              }

              try {
                plus.nativeUI.closeWaiting();
              } catch (e) {
                console.log(e.message);
              }
            }).catch(error => {
              this.$terminal._error(error)
            });

          }
        }, 100);

      },
      init() {//初始化
        var _this = this;

        var xcdx_map_manager = localStorage.getItem("xcdx_map_manager") ? JSON.parse(localStorage.getItem("xcdx_map_manager")) : { from: '/index', init: false };
        if (xcdx_map_manager.init) {
          xcdx_map_manager.init = false;
          localStorage.removeItem("xcdx_map_action");
          localStorage.removeItem("xqda_params");
          localStorage.removeItem("xcdx_map_result_obj");
          localStorage.removeItem("xcdx_map_searchByType");

          _this.userId = localStorage.getItem("userId"); //用户id
          console.log(terminal.terminals());
          if (terminal.terminals().android || terminal.terminals().iPhone || terminal.terminals().iPad) {
            _this.isPc = false;
          } else {
            _this.isPc = true;
          }
          _this.terminal = terminal.terminals().android;
          //_this.terminal = false;
          _this.showTypes = true;
          _this.b_type = 'jxmd';
          _this.s_type = '';
          _this.searchValue = '';
          _this.no_data = false;
          _this.showDetail = false;
          _this.detailObj = {};
          _this.search_list = [];
          _this.li_click_obj = {};
          _this.types = {};
          _this.jdsqObj = {};
          _this.createXcdx_tk = false;
          _this.createXcdx_obj = '';
          _this.xclb_tk = false;
          _this.xclb_obj = {};

          _this.loading = false;
          _this.finished = false;
          _this.refreshing = false;
          _this.page = 1;
          _this.pageSize = 20;
          _this.mhcx_position = null;
          _this.fenye_flag = false;
          _this.mhcx_flag = false;
          _this.yc_flag = false;

          _this.getTypes();
          _this.getJdsq();
          _this.getuUserQx();

          if (_this.map) {
            if (_this.userMarker) {
              _this.map.remove(_this.userMarker);
            }
            _this.userMarker = null;
            _this.startGeolocation();
          } else {
            _this.userMarker = null;
            var AMap_timer = setInterval(function () {
              if (AMap) {
                clearInterval(AMap_timer);
                _this.createMap();
              }
            }, 100);
          }

          var flag1 = false;
          var flag2 = false;
          if (_this.timer7 || _this.timer7 === 0) {
            return;
          }
          _this.timer7 = setInterval(function () {
            if (_this.map && (!flag1)) {
              _this.map.remove(_this.markers);
              _this.markers = [];
              _this.map.setFitView();
              flag1 = true;
              console.log('地图清空markers，重设缩放级别');
            }
            if (_this.userMarker && (!flag2)) {
              _this.setCenterFlag = true;
              flag2 = true;
              console.log('地图设置当前位置为中心点');
            }
            if (_this.map && _this.types['jxmd'] && (_this.jdsqObj.lev || _this.jdsqObj.lev === 0 || _this.jdsqObj.lev === '0') && _this.userMarker && flag1 && flag2) {
              clearInterval(_this.timer7);
              _this.timer7 = null;
              console.log('地图重置完毕');
              _this.getList();
            }
          }, 100);

        } else {
          if (_this.map) {
            if (_this.userMarker) {
              _this.map.remove(_this.userMarker);
            }
            _this.userMarker = null;
            _this.startGeolocation();
          } else {
            _this.userMarker = null;
            var AMap_timer = setInterval(function () {
              if (AMap) {
                clearInterval(AMap_timer);
                _this.createMap();
              }
            }, 100);
          }
          var xcdx_map_result_obj = localStorage.getItem("xcdx_map_result_obj");
          if (xcdx_map_result_obj) {
            _this.search_list = [];
            _this.searchValue = '';
            _this.mhcx_flag = false;
            _this.fenye_flag = false;
            var xcdx_map_searchByType = localStorage.getItem("xcdx_map_searchByType") ? JSON.parse(localStorage.getItem("xcdx_map_searchByType")) : null;
            if (xcdx_map_searchByType) {
              _this.b_type = xcdx_map_searchByType.b_type;
              _this.s_type = xcdx_map_searchByType.s_type;
            }
            _this.getList();
          }
          localStorage.removeItem("xcdx_map_action");
          localStorage.removeItem("xcdx_map_result_obj");
          localStorage.removeItem("xcdx_map_searchByType");
        }
        localStorage.setItem("xcdx_map_manager", JSON.stringify(xcdx_map_manager));
        _this.xcdx_map_manager = xcdx_map_manager;

      }
    },
    beforeRouteLeave(to, from, next) {
      this.stopGeolocation();
      next();
    },
    //进入该页面时
    beforeRouteEnter(to, from, next) {
      next(vm => {
        vm.init();
      })
    },
    mounted() {
      var _this = this;
      //this.createMap();
      //this.init();

      //物理返回
      // window.addEventListener("popstate", function(){
      //   _this.getBack();
      // }, false);
    },
    created() {

    }
  };
</script>
<style scoped>
  .contant {
    border: 1px solid white;
    flex: 1;
    display: flex;
    flex-direction: column;
  }

  .header {
    height: 1.8519rem;
    background: #007aff;
    padding-top: 0.8333rem;
    box-sizing: border-box;
    width: 100%;
    z-index: 20;
    font-size: 0.388888rem;
  }

  .title {
    padding: 0 0.3704rem;
    display: flex;
    align-items: center;
    color: #fff;
  }

  .title>div {
    width: 100%;
    font-size: 0.4444rem;
    text-align: center;
  }

  .img_zuo {
    width: 0.2593rem;
    height: 0.463rem;
  }

  .body {
    width: 100%;
    height: 100%;
    position: fixed;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
  }

  #ditu {
    width: 100%;
    flex: 1;
  }

  /*类别*/
  .types {
    /*width: 100%;*/
    width: 2.35rem;
    height: auto;
    position: absolute;
    bottom: 0.37037rem;
    left: 0.37037rem;
    z-index: 100;
    font-size: 0.296296rem;
  }

  .types ul,
  .types li {
    list-style: none;
    margin: 0;
    padding: 0;
    /*width: 100%;*/
  }

  .types ul {
    border-radius: 0.222222rem;
    overflow: hidden;
    background: #FFFFFF;
    padding-bottom: 0.37037rem;
    padding-top: 0.37037rem;
  }

  .types li {
    height: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: flex-start;
  }

  .types .qiege {
    width: 0.296296rem;
    height: 0.296296rem;
    overflow: hidden;
    margin-left: 0.185185rem;
  }

  .types .value {
    height: 100%;
    display: flex;
    align-items: center;
    margin-left: 0.2rem;
    margin-right: 0.05rem;
    flex: 1;
  }

  .types li img {
    width: 2.96296rem;
    height: 5.74074rem;
    position: relative;
    left: -0.925925rem;
    top: -0.37037rem;
  }

  .types .qiege_blank {
    left: 0.925925rem !important;
    top: 0.37037rem !important;
  }

  .types button {
    width: 1.055555rem;
    height: 1.055555rem;
    z-index: 144;
    border: none;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.222222rem;
    margin-top: 0.185185rem;
    outline: none;
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0);
    -webkit-focus-ring-color: rgba(0, 0, 0, 0);
    background-color: #f7f7f7;
  }

  .types button img {
    width: 0.509259rem;
    height: 0.453703rem;
  }

  .types .active {
    color: #2b6cfe;
  }

  /*搜索框*/
  .search-box {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f7f7f7;
  }

  .search-box .search-input {
    flex: 1;
    height: 1.111111rem;
    border-radius: 0.925925rem;
    overflow: hidden;
    margin: 0.185185rem 0.37037rem;
    display: flex;
    position: relative;
    background-color: #FFFFFF;
  }

  .search-box .search-input input {
    height: 100%;
    flex: 1;
    background-color: #FFFFFF;
    margin-left: 0.37037rem;
  }

  .search-box .search-img {
    width: 0.851851rem;
    height: 100%;
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    align-items: center;
  }

  .search-box .search-img img {
    width: 0.481481rem;
    height: 0.481481rem;
  }

  .search-box .search-search-btn {
    height: 1.111111rem;
    margin-right: 0.37037rem;
    color: #2b6cfe;
    display: flex;
    align-items: center;
  }

  /*搜索结果*/
  .search_list {
    width: 100%;
    height: 4.5rem;
    overflow-y: scroll;
  }

  .search_list .list_li {
    width: 100%;
    height: 1.111111rem;
    border-bottom: 0.018518rem solid #DDDDDD;
    display: flex;
    align-items: center;
  }

  .search_list .list_li img {
    width: 0.472222rem;
    height: 0.638888rem;
    margin-left: 0.37037rem;
    margin-right: 0.185185rem;
  }

  .search_list .list_li .name {
    width: 2.5rem;
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .search_list .list_li .address {
    flex: 1;
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    margin-left: 0.185185rem;
  }

  .search_list .list_li .type {
    width: 2rem;
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    padding-right: 0.37037rem;
    margin-left: 0.185185rem;
    text-align: right;
  }

  /*创建巡查对象按钮*/
  .create-xcdx-btn {
    width: 100%;
    display: flex;
    flex-direction: column;
  }

  .create-xcdx-btn button {
    margin-top: 0.37037rem;
    margin-left: 0.74074rem;
    margin-right: 0.74074rem;
    margin-bottom: 0.555555rem;
    width: auto;
    background-color: #2b6cfe;
    color: #FFFFFF;
    height: 1.074074rem;
    border-radius: 0.148148rem;
    font-size: 0.388888rem;
  }

  /* 弹框 */
  .tk {
    width: 100%;
    height: 100%;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 130;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.388888rem;
  }

  .tk .tk-bg {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 131;
    background-color: rgba(0, 0, 0, 0.4);
  }

  .tk .tk-box {
    width: 8rem;
    background-color: #FFFFFF;
    z-index: 132;
    display: flex;
    flex-direction: column;
    border-radius: 0.222222rem;
    padding-bottom: 0.37037rem;
  }

  .tk .tk-head {
    width: auto;
    height: 1.4351851851851851rem;
    border-bottom: 1px #ddd solid;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-left: 0.37037rem;
    margin-right: 0.37037rem;
  }

  .tk .tk-head .tk-head-title {
    flex: 1;
    height: 1.4351851851851851rem;
    display: flex;
    align-items: center;
  }

  .tk .tk-head .tk-head-close {
    width: 0.37037rem;
    height: 0.37037rem;
  }


  .tk .tk-list {
    flex: 1;
    width: 100%;
    overflow-y: scroll;
  }

  .tk .tk-item {
    width: auto;
    height: 1.3888888888888888rem;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-left: 0.37037rem;
    margin-right: 0.37037rem;
    border-bottom: 1px solid #DDDDDD;
  }

  .tk .tk-item .tk-item-name {
    display: flex;
    width: 1.8rem;
  }

  .tk .tk-item .tk-item-value {
    margin-left: 0.185185rem;
    height: 100%;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
  }

  .tk .tk-item .tk-item-value input {
    width: 5.555555rem;
    height: 100%;
  }

  .tk .tk-list .tk-item-checked {
    color: #2a6cfe;
  }

  .tk .tk-list .tk-item-select {
    height: 100%;
    display: flex;
    align-items: center;
  }

  .tk .tk-list .tk-item-select img {
    width: 0.444444rem;
    height: 0.444444rem;
  }

  .tk .tk-block {
    margin-left: 0.37037rem;
    margin-right: 0.37037rem;
    width: auto;
    display: flex;
    flex-wrap: wrap;
    border-bottom: 1px solid #DDDDDD;
    padding-left: 0.74074rem;
  }

  .tk .tk-block-value {
    width: 50%;
    height: 1.3888888888888888rem;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    border-top: 1px solid #DDDDDD;
  }

  .tk .tk-block-value:nth-child(1),
  .tk .tk-block-value:nth-child(2) {
    border-top: 0 !important;
  }

  .tk .tk-btns {
    width: 100%;
    height: auto;
    display: flex;
    align-items: center;
    margin-top: 0.37037rem;
  }

  .tk .tk-btns .tk-btn {
    margin-left: 1rem;
    margin-right: 1rem;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 1.074074rem;
    background: #309dfa;
    color: #fff;
    font-size: 0.444444rem;
    border-radius: 0.148148rem;
  }

  .tk .xz-tk {
    height: 5rem !important;
  }


  .no_data_tk .tk-item {
    border-bottom: none !important;
    justify-content: center !important;
  }

  .no_data_tk .tk-item:nth-child(1) {
    margin-top: 0.37037rem;
  }


  .showDetail_tk .tk-head {
    border-bottom: none !important;
    height: 1rem !important;
  }

  .showDetail_tk .tk-head .tk-head-title {
    height: auto !important;
  }

  .showDetail_tk .tk-item {
    border-bottom: none !important;
    height: auto !important;
    margin-bottom: 0.333333rem;
  }

  .showDetail_tk .tk-box {
    width: 7rem !important;
  }

  .showDetail_tk .tk-item-value {
    justify-content: flex-start !important;
  }


  .createXcdx_tk .createXcdx_wwc {
    background-color: #DDDDDD !important;
  }

  .xclb_tk .active {
    color: #2b6cfe;
  }

  .fenye {
    height: auto !important;
    flex: 1;
  }

  .zw-span {
    color: #FFFFFF;
  }
</style>
